#include "SDL2/SDL.h"
void DrawPoints(SDL_Renderer *renderer)
{
    int x, y;
    SDL_Rect viewport;

    //获取渲染目标（render target）的视口（viewport）信息
    SDL_RenderGetViewport(renderer, &viewport);

    //设置渲染器的绘制颜色
    // renderer：渲染器，表示你要设置绘制颜色的目标。
    // r、g、b、a：表示颜色的红、绿、蓝和透明度分量，取值范围为0-255。
    SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);

    x = 100;
    y = 200;
    SDL_RenderDrawPoint(renderer, x, y);
    SDL_SetRenderDrawColor(renderer, 255, 0, 255, 255);

    x = 200;
    y = 200;
    SDL_RenderDrawPoint(renderer, x, y);
}
int main(int argc, char *argv[])
{
    SDL_Event event;
    //创建窗口
    SDL_Window *window = SDL_CreateWindow("Hello, World!", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, 0);


    //创建2D渲染上下文
    SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, 0);
    DrawPoints(renderer);
    //刷新显示
    SDL_RenderPresent(renderer);

    //监听操作
    while (SDL_WaitEvent(&event)) {
        if (event.type == SDL_QUIT || event.type == SDL_KEYUP) {
            break;
        }
    }

    SDL_Quit();
    return 0;
}